package com.guangyunl.f_while;
// 用while循环求1-100的偶数和
public class Demo03While {
    public static void main(String[] args) {
        int i = 1;
        int sum = 0;
        while (i <= 100){
            if (i % 2 == 0){
                sum += i;
            }
            i++;
        }
        System.out.println("sum = " + sum); // sum = 2550
    }
}
